package org.i1510.common.utils.quartz;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.betwixt.io.BeanReader;
import org.i1510.common.bean.FileBean;
import org.i1510.common.bean.SpringQuartzBeans;
import org.i1510.common.utils.file.FileManager;
import org.junit.Test;
import org.xml.sax.SAXException;

public class QuartzTest {

	@Test
	public void QuTest(){
		String location = "classpath:/config/**/spring-quartz.xml"; 
    	FileManager fm = new FileManager(); 
        try { 
        	List<FileBean> fileList = new ArrayList<FileBean>();
        	fileList = fm.readFile(location); 
        	
    		
    		
    		for (int i = 0; i < fileList.size(); i++) {
    			// 创建一个BeanReader实例，相当于转换器
        		BeanReader beanReader = new BeanReader();
        		//创建xml对应beans
        		SpringQuartzBeans springQuartzBeans = new SpringQuartzBeans();
        		beanReader.push(springQuartzBeans);
        		//增加规则
        		QuartzHandler qh = new QuartzHandler();    		
        		qh.loadSpringQuartzXmlRules(beanReader);
        		FileBean springXml = (FileBean)fileList.get(i);
        		//加载xml数据
    			beanReader.parse(springXml.getFile());
    			
    			
    			
			}
    		
    		
     
        } catch (IOException e) { 
            e.printStackTrace(); 
        } catch (SAXException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
	}
}
